<%@ page language="java" contentType="text/html; charset=UTF-8" import="java.util.*,com.javabean.*,com.model.*"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户信息修改</title>
<link rel="stylesheet" rev="stylesheet" href="../css/style.css" type="text/css" media="all" />
<link rel="stylesheet" type="text/css"
	href="../jqueryui/development-bundle/themes/base/jquery.ui.all.css" />
<script src="../jqueryui/js/jquery-1.9.0.js"></script>
<script src="../jqueryui/js/jquery-ui-1.10.0.custom.min.js"></script>

<style type="text/css">
<!--
.atten {font-size:12px;font-weight:normal;color:#F00;}
-->
</style>
</head>


<body class="ContentBody">
  <script language="JavaScript" type="text/javascript">
  function change1(){
	  var isManger1=document.getElementById("isManager");
	  isManger1.value="是";
  }
  function change2(){
	  var isManger2=document.getElementById("isManager");
	  isManger2.value="否";
  }
  function save(){
		if(document.fom.userDepartment.value == null || document.fom.userDepartment.value == ""){
			alert("所属部门必须填写");
			document.fom.userDepartment.focus();
			return;
		}
		else if(document.fom.userOffice.value == null || document.fom.userOffice.value == ""){
			alert("截止日期必须填写");
			document.fom.userOffice.focus();
			return;
		}
		else if(confirm("确认保存？")){
			document.fom.submit();			
		}
	}
  </script>
<div class="MainDiv">
	<form action="UserDeal?flag=changeUser" method="post" name="fom" id="fom">
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
  <tr>
      <th class="tablestyle_title" >用户信息修改</th>
  </tr>
  <tr>
    <td class="CPanel">
		<%
		String userNumber=request.getParameter("userNumber");
		User user=new UserService().getUserByName(userNumber);
		String isManeger="是";
		int userGrade=user.getUserGrade();
        if(user.getUserGrade()==0){
        	isManeger="否";}
		%>
	
		<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
		<tr><td align="left">
		</td></tr>
				<tr>
			<td width="100%">
				<fieldset style="height:100%;">
				<legend>用户信息</legend>
					  <table border="0" cellpadding="2" cellspacing="1" style="width:100%">
					 
					  <tr>
					    <td nowrap="nowrap" align="right" width="15%">姓名:</td>
					    <td width="35%"><input name="userName" type="text" readonly="readonly" class="text" style="width:154px" value="<%=user.getUserName() %>" /></td>
					    <td width="16%" align="right" nowrap="nowrap">工号:</td>
					    <td width="34%"><input class="text" type="text" name="userNumber" readonly="readonly" style="width:154px" value="<%=user.getUserNumber() %>"/>
					    <input class="text" name="userId" type="hidden"style="width:154px" value="<%=user.getUserId() %>"/></td>
					  </tr>
					    
					    
					  <tr>
					    <td nowrap="nowrap" align="right">所属部门:</td>
					    <td><input class="text" name="userDepartment" style="width:154px" value="<%=user.getUserDepartment()%>"/></td>
					    <td align="right">办公地点:</td>
					    <td><input class="text" name="userOffice" style="width:154px" value="<%=user.getUserOffice() %>"/></td>
					  </tr>
                      
                      <tr>
					    <td nowrap="nowrap" align="right">是否为管理员:</td>
					    <td><input class="text" name="Grade" id="isManager"style="width:154px" readonly="readonly" value="<%=isManeger%>"/><input type="hidden" name="userGrade" value="<%=user.getUserGrade()%>"/>
					    <input type="hidden" name="userPassword" value="<%=user.getUserPassword() %>"/></td>
					    <td align="right">权限设置:</td>
					    <td>
					    <div id="authority">
					       <% if(userGrade==1||userGrade==3||userGrade==5||userGrade==7||userGrade==9||userGrade==11||userGrade==13||userGrade==15){%>
					    	<input name="checkbox" type="checkbox" id="car" value="car" onclick="" checked="checked" /><label for="car">车辆</label><%}else{ %>
					    	<input name="checkbox" type="checkbox" id="car" value="car" onclick="" /><label for="car">车辆</label> <% }%>
					    	<% if(userGrade==2||userGrade==3||userGrade==6||userGrade==7||userGrade==10||userGrade==11||userGrade==14||userGrade==15){%>
					    	<input name="checkbox" type="checkbox" id="item" value="item" onclick="" checked="checked" /><label for="item">物品</label><%}else{ %>
					    	<input name="checkbox" type="checkbox" id="item" value="item" onclick="" /><label for="item">物品</label> <% }%>
					    	<% if(userGrade==4||userGrade==5||userGrade==6||userGrade==7||userGrade==12||userGrade==13||userGrade==14||userGrade==15){%>
					    	<input name="checkbox" type="checkbox" id="device" value="device" onclick="" checked="checked"/><label for="device">设备</label><%}else{ %>
					    	<input name="checkbox" type="checkbox" id="device" value="device" onclick="" /><label for="device">设备</label> <% }%>
					    	<% if(userGrade==8||userGrade==9||userGrade==10||userGrade==11||userGrade==12||userGrade==13||userGrade==14||userGrade==15){%>
					    	<input name="checkbox" type="checkbox" id="meetingroom" value="meetingroom" onclick="" checked="checked"/><label for="meetingroom">会议室</label><%}else{ %>
					    	<input name="checkbox" type="checkbox" id="meetingroom" value="meetingroom" onclick="" /><label for="meetingroom">会议室</label><% }%>
					    </div>
					    </td>
					  </tr>
					 
					  <tr>
					    <td align="right">备注:</td>
					    <td colspan="3"><textarea name="userDescription" cols="100" rows="8" ><%=user.getUserDescription() %></textarea></td>
					  </tr>
					  </table>
			  <br />
				</fieldset></td>
		</tr>
		</table>
	 </td>
  </tr>
		<tr>
			<td colspan="2" align="center" height="50px">
			<input type="button" name="Submit" value="保存" class="button" onclick="save()"/>　
			<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/></td>
		</tr>
		</table>
	</form>
</div>

<script>
	$("#car,#item,#decive,#meetingroom").button();
	$("#authority").buttonset();
</script>
</body>
</html>
